<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>堆快照监控内存</title>
  </head>
  <body>
    <button id="btn">Try</button>
    <script>
      var tmpEle
      // ul没有在页面上面呈现但是被JS引用所以是分离DOM
      function fn() {
        var ul = document.createElement('ul')
        for (var i = 0; i < 10; i++) {
          var li = document.createElement('li')
          ul.appendChild(li)
        }
        // detached HTMLUListElement
        // detached HTMLLIElement
        tmpEle = ul
        //
        // ul= null 节点清空就可以了~
      }
      document.getElementById('btn').addEventListener('click', fn)
    </script>
  </body>
</html>
